﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LotteryVote.Entity;

namespace LotteryVote.Logic.Member
{
    public class UserStrategyFactory
    {
        private static UserStrategyFactory _factory;
        private UserStrategyFactory() { }

        public static UserStrategyFactory GetFactory()
        {
            if (_factory == null)
                _factory = new UserStrategyFactory();
            return _factory;
        }

        public UserStrategy GetUserStrategy(SystemRole role)
        {
            switch (role)
            {
                case SystemRole.Super:
                case SystemRole.Master:
                case SystemRole.Agent:
                    return new ProxyStrategy();
                case SystemRole.Guest:
                    return new MemberStrategy();
                default: throw new ApplicationException("不能创建其他角色的用户!");
            }
        }
    }
}
